package com.future.mayi.activity;

import android.text.TextUtils;
import android.webkit.WebView;

import com.future.baselib.entity.DefaultResponse;
import com.future.baselib.utils.ApiCst;
import com.future.baselib.utils.HttpRequest;
import com.future.mayi.R;
import com.future.mayi.utils.HtmlFormat;

import butterknife.BindView;

public class AgreementActivity extends BaseTitleActivity {
    @BindView(R.id.web_view)
    WebView webView;

    @Override
    protected void initTopBar() {
        initBack();
        getTitleText().setText("用户注册协议");
    }

    @Override
    protected void initLayout() {
        setContentView(R.layout.activity_agreement);
    }

    @Override
    protected void initView() {
        new HttpRequest<DefaultResponse>()
                .with(this)
                .setApiCode(ApiCst.getYhxy)
                .setListener(new HttpRequest.OnNetworkListener<DefaultResponse>() {
                    @Override
                    public void onSuccess(DefaultResponse response) {
                        String data = response.content;
                        if (!TextUtils.isEmpty(data)) {
                            webView.loadDataWithBaseURL(null, HtmlFormat.getNewContent(data), "text/html", "utf-8", null);
                        }
                    }

                    @Override
                    public void onFail(String message, DefaultResponse response) {

                    }
                })
                .start(new DefaultResponse());
    }

    @Override
    protected void initDates() {

    }

    @Override
    protected void initListener() {

    }


}
